<!-- <script setup>
import { reactive, toRefs, toRef, toRaw } from "vue";

// let ruleFormbase = reactive({
//   pass: "111",
//   checkPass: "2222",
//   age: "2222",
// });
// setTimeout(() => {
//   ruleForm = {
//     pass: "aaa",
//     checkPass: "bbb",
//     age: "ccc",
//   };
//   console.log(ruleForm);
// }, 2000);

// 在reactive中声明一个key就可以实现ref的响应效果
// let ruleForm = reactive({
//   value: {
//     pass: "111",
//     checkPass: "2222",
//     age: "2222",
//   },
// });
// setTimeout(() => {
//   ruleForm.value = {
//     pass: "aaa",
//     checkPass: "bbb",
//     age: "ccc",
//   };
//   console.log(ruleForm);
// }, 2000);

// 通过object.assign实现
let ruleForm = reactive({
  pass: "111",
  checkPass: "2222",
  age: "2222",
});
setTimeout(() => {
  Object.assign(ruleForm, { pass: 'aaa', checkPass: 'bbb', age: "ccc" })
},2000)
</script> -->
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'

const ruleFormRef = ref<FormInstance>()

const ruleForm = reactive({
  pass: '',
  checkPass: '',
  age: '',
})
</script>
<template>
  {{ ruleForm }}
  <div class="about">
    <el-form
      ref="ruleFormRef"
      style="max-width: 600px"
      :model="ruleForm"
      status-icon
      label-width="auto"
      class="demo-ruleForm"
    >
      <el-form-item label="Password" prop="pass">
        <el-input v-model="ruleForm.pass" autocomplete="off" />
      </el-form-item>
      <el-form-item label="Confirm" prop="checkPass">
        <el-input v-model="ruleForm.checkPass" autocomplete="off" />
      </el-form-item>
      <el-form-item label="Age" prop="age">
        <el-input v-model.number="ruleForm.age" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary"> Submit </el-button>
        <el-button>Reset</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<style>
@media (min-width: 1024px) {
  .about {
    min-height: 100vh;
    display: flex;
    align-items: center;
  }
}
</style>
